﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjTemp.Desktop.Common.MessageBox
{
    public static class MessageBoxHelper
    {
        public static void Info(string text, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            messageBox.Show(text, title, MessageBoxButton.OK, showImage ? MessageBoxImage.Information : MessageBoxImage.None);
        }

        public static void Warn(string warn, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            messageBox.Show(warn, title, MessageBoxButton.OK, showImage ? MessageBoxImage.Warning : MessageBoxImage.None);
        }

        public static void Error(string error, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            messageBox.Show(error, title, MessageBoxButton.OK, showImage ? MessageBoxImage.Error : MessageBoxImage.None);
        }

        public static bool Confirm(string question, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            return messageBox.Show(question, title, MessageBoxButton.OKCancel, showImage ? MessageBoxImage.Question : MessageBoxImage.None) == MessageBoxResult.OK;
        }

        public static bool ConfirmYesNo(string question, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            return messageBox.Show(question, title, MessageBoxButton.YesNo, showImage ? MessageBoxImage.Question : MessageBoxImage.None) == MessageBoxResult.Yes;
        }

        public static bool? ConfirmYesNoCancel(string question, string title = "", bool showImage = true)
        {
            IMessageBox messageBox = new MessageBoxService();
            switch (messageBox.Show(question, title, MessageBoxButton.YesNoCancel, showImage ? MessageBoxImage.Question : MessageBoxImage.None))
            {
                case MessageBoxResult.Yes:
                    return true;
                case MessageBoxResult.No:
                    return false;
                default:
                    return null;
            }
        }
    }
}
